sprs, sparse matrices for Rust
sprs implements some sparse matrix data structures and linear algebra algorithms in pure Rust.
The API is a work in progress, and feedback on its rough edges is highly appreciated :)
Features
Structures
- CSR/CSC matrix
- triplet matrix
- Sparse vector
Operations
- sparse matrix / sparse vector product
- sparse matrix / sparse matrix product
- sparse matrix / sparse matrix addition, subtraction
- sparse vector / sparse vector addition, subtraction, dot product
- sparse/dense matrix operations
Algorithms
- Outer iterator on compressed sparse matrices
- sparse vector iteration
- sparse vectors joint non zero iterations
- simple sparse Cholesky decomposition (requires opting into an LGPL license)
- sparse triangular solves with dense right-hand side
Examples
Matrix construction
use ;
let eye : = eye;
let a = new_csc;
Matrix vector multiplication
use ;
let eye = eye;
let x = new;
let y = &eye * &x;
assert_eq!;
Matrix matrix multiplication, addition
use ;
let eye = eye;
let a = new_csc;
let b = &eye * &a;
assert_eq!;
For a more complete example, be sure to check out the heat diffusion example.
Documentation
Documentation is available at docs.rs.
Changelog
See the changelog.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Please see the contribution guidelines for additional information about contributing.